Getting Started
VPNWholesaler.com Custom In-App SDK is intended for Development Teams that want to fully customize their VPN apps based their requirements.
Windows
Minimum OS version supported: Windows 7
Recommended Development tool
Visual Studio 2022
C++ Dynamic lib
Follow the steps below to add the SDK dynamic lib to your project:
- Download the dynamic library from the Downloads section
- Unpack the downloaded archive to a folder
- Copy the folder for the platform you need (x64, x86) to the folder with your project
- To add files to your project
Open or create a project in Visual Studio > go to Solution Explorer > right-click (RMB) on the name of your project > Properties- Dll files. In the copied folder go to
bin > copy all dll files > paste them into the root folder of the project - h files. In the opened window go to
Configuration Properties > C/C++ > General >Additional include directories > Edit > Add the path to the folder with header files (in this Sdk the folder name - "include").Add#include <CoreAPI.h> to the file that you plan to use the SDK commands with. - lib files. In the opened window go to
Configuration Properties > Linker > General > Additional Library Directories > Edit > Add the path to the folder with library files (in this Sdk the folder name - "lib") - In the opened window go to
Configuration Properties > Linker > Input > Additional Dependencies > Edit > Enter "vwcore.dll.lib;jsoncpp.lib;libcurl_imp.lib" - In the Properties window go to
Configuration Properties > C/C++ > Code Generation > Runtime Library > Set the Multi-threaded DLL (/MD)
- Dll files. In the copied folder go to
C++ Static lib
Follow the steps below to add the SDK static lib to your project:
- Download the static library from the Downloads section
- Unpack the downloaded archive to a folder
- Copy the folder for the platform you need (x64, x86) to the folder with your project
- To add files to your project
Open or create a project in Visual Studio > go to Solution Explorer > right-click (RMB) on the name of your project > Properties- Set "Configuration" to
Release - h files. In the Properties window go to
Configuration Properties > C/C++ > General >Additional include directories > Edit > Add the path to the folder with header files (in this Sdk the folder name - "include"). Add#include <CoreAPI.h> to the file that you plan to use the SDK commands with. - lib files. In the Properties window go to
Configuration Properties > Linker > General > Additional Library Directories > Edit > Add the path to the folder with library files (in this Sdk the folder name - "lib") - In the Properties window go to
Configuration Properties > Linker > Input > Additional Dependencies > Edit > Enter "vwcore.lib; Rpcrt4.lib; Iphlpapi.lib; ws2_32.lib; wldap32.lib" - In the Properties window go to
Configuration Properties > C/C++ > Code Generation > Runtime Library > Set the Multi-threaded (/MT) - In the Properties window go to
Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions > Add OVS_STATICLIB
- Set "Configuration" to
Windows C#
.Net Framework supported: 3.5, 4.5
Visual Studio 2022
Please follow the steps below to use the SDK as a part of a .NET project:
- Download dynamic library with dependencies
- Define a callback signature. This callback will be invoked from SDK when the request result is ready. Please note that all operations in the SDK are called asynchronously and callback is invoked in the thread associated with SDK.
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate bool Callback([MarshalAs(UnmanagedType.LPStr)]string Mesg);
Callback callback = new Callback(CallbackHandler);
public bool CallbackHandler(String value)
{
Console.WriteLine(‘callback data = ‘ + value);
}
- Import main SDK methods from DLL:
[DllImport("vwcore.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern void CmdProc(String param);
[DllImport("vwcore.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern int InitOVSCore([MarshalAs(UnmanagedType.FunctionPtr)] Callback callbackPointer);
[DllImport("vwcore.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern void FinalizeOVSCore();
- Use the SDK methods in the same manner as a C++ project
MacOS
Static lib
Follow the steps below to add the SDK static lib to your project:
- Download the static library from the Downloads section
- Unpack the downloaded archive to a folder
- Copy the folder to the folder with your project
- To add header file
Open or create a project in Xcode > go to Project navigator > right-click (RMB) on the name of your project > Add files > add CoreAPI.h. Also add#include "CoreAPI.h"to the file that you plan to use the SDK commands with. - lib files.
Double click on your project > go to targets window > General > Add libvwcore.a to the "Frameworks and libraries". Also add hereFoundation.framework. Then go toBuild phases > Link Binary with libraries > add libvwcore.a and Foundation.framework
Additional Information
It is necessary to launch the application as an administrator (For Windows and MacOS).
Folders with OpenVPN, SS2, and WireGuard (located in the bin folder of this sdk) should be moved to the directory where executable file is located. Also, on Windows for the proper functioning of the application, it is necessary to install
Notes
The examples provided below are written using the third-party library nlohmann/json. These examples are not part of the SDK, so there is no need to use them exactly as they are presented. These examples are meant to demonstrate one of the ways to use this SDK.
Additional library
https://github.com/nlohmann/json
Using
#include <nlohmann/json.hpp>
using json = nlohmann::json;